package com.dongdongkeji.wangwangsocial;

import android.content.Context;

/**
 * App 全局类, 在Application中初始化此类
 * 用于添加全局回调监听
 * 可通过此类获取App上下文Context
 * Author: ChenJing
 * Date: 2017-06-20 下午 3:55
 * Version: 1.0
 */

public class AppContext {

    private Context context;
    private static AppContext instance;

    private AppContext() {
    }

    public static AppContext getInstance(){
        if (instance == null){
            synchronized (AppContext.class){
                if (instance == null){
                    instance = new AppContext();
                }
            }
        }
        return instance;
    }

    public void init(Context context){
        this.context = context;
    }

    public Context getContext(){
        return context;
    }
}
